txh_shared <- highlight_key(txhousing, ~year)
p <- ggplot(txh_shared, aes(month, median)) +
geom_line(aes(group = year)) +
geom_smooth(data = txhousing, method = "gam") +
scale_x_continuous("", breaks=seq(1, 12, 1),
labels=c("J", "F", "M", "A", "M", "J",
"J", "A", "S", "O", "N", "D")) +
scale_y_continuous("Median price ('00,000)",
breaks = seq(0,300000,100000),
labels = seq(0,3,1)) +
facet_wrap(~ city)
gg <- ggplotly(p, height = 750, width = 900) %>%
plotly::layout(title = "Click on a line to highlight a year")